package com.gt.admin.controller;

import com.gt.common.core.controller.BaseController;
import com.gt.common.core.domain.AjaxResult;
import com.gt.admin.domain.MenuSecond;
import com.gt.admin.service.IMenuSecondService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 二级目录controller
 */
@Api(tags = "sc-二级目录")
@RestController
@RequestMapping("/secondMenu")
public class MenuSerondController extends BaseController {
    @Autowired
    private IMenuSecondService menuSecondService;

    @ApiOperation("获取树状列表")
    @GetMapping
    public AjaxResult list(MenuSecond menuSecond){
        List<MenuSecond> menuSeconds = menuSecondService.selectList(menuSecond);
        return AjaxResult.success(menuSecondService.buildMenuTree(menuSeconds));
    }
}
